//using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using System.Runtime.InteropServices;
 // ERROR: Not supported in C#: OptionDeclaration
namespace NCS_CS
{
	static class DASK
	{

//ADLink PCI Card Type
		public const short PCI_6208V = 1;
		public const short PCI_6208A = 2;
		public const short PCI_6308V = 3;
		public const short PCI_6308A = 4;
		public const short PCI_7200 = 5;
		public const short PCI_7230 = 6;
		public const short PCI_7233 = 7;
		public const short PCI_7234 = 8;
		public const short PCI_7248 = 9;
		public const short PCI_7249 = 10;
		public const short PCI_7250 = 11;
		public const short PCI_7252 = 12;
		public const short PCI_7296 = 13;
		public const short PCI_7300A_RevA = 14;
		public const short PCI_7300A_RevB = 15;
		public const short PCI_7432 = 16;
		public const short PCI_7433 = 17;
		public const short PCI_7434 = 18;
		public const short PCI_8554 = 19;
		public const short PCI_9111DG = 20;
		public const short PCI_9111HR = 21;
		public const short PCI_9112 = 22;
		public const short PCI_9113 = 23;
		public const short PCI_9114DG = 24;
		public const short PCI_9114HG = 25;
		public const short PCI_9118DG = 26;
		public const short PCI_9118HG = 27;
		public const short PCI_9118HR = 28;
		public const short PCI_9810 = 29;
		public const short PCI_9812 = 30;
		public const short PCI_7396 = 31;
		public const short PCI_9116 = 32;
		public const short PCI_7256 = 33;
		public const short PCI_7258 = 34;

		public const short MAX_CARD = 32;

//Error Code
		public const short NoError = 0;
		public const short ErrorUnknownCardType = -1;
		public const short ErrorInvalidCardNumber = -2;
		public const short ErrorTooManyCardRegistered = -3;
		public const short ErrorCardNotRegistered = -4;
		public const short ErrorFuncNotSupport = -5;
		public const short ErrorInvalidIoChannel = -6;
		public const short ErrorInvalidAdRange = -7;
		public const short ErrorContIoNotAllowed = -8;
		public const short ErrorDiffRangeNotSupport = -9;
		public const short ErrorLastChannelNotZero = -10;
		public const short ErrorChannelNotDescending = -11;
		public const short ErrorChannelNotAscending = -12;
		public const short ErrorOpenDriverFailed = -13;
		public const short ErrorOpenEventFailed = -14;
		public const short ErrorTransferCountTooLarge = -15;
		public const short ErrorNotDoubleBufferMode = -16;
		public const short ErrorInvalidSampleRate = -17;
		public const short ErrorInvalidCounterMode = -18;
		public const short ErrorInvalidCounter = -19;
		public const short ErrorInvalidCounterState = -20;
		public const short ErrorInvalidBinBcdParam = -21;
		public const short ErrorBadCardType = -22;
		public const short ErrorInvalidDaRange = -23;
		public const short ErrorAdTimeOut = -24;
		public const short ErrorNoAsyncAI = -25;
		public const short ErrorNoAsyncAO = -26;
		public const short ErrorNoAsyncDI = -27;
		public const short ErrorNoAsyncDO = -28;
		public const short ErrorNotInputPort = -29;
		public const short ErrorNotOutputPort = -30;
		public const short ErrorInvalidDioPort = -31;
		public const short ErrorInvalidDioLine = -32;
		public const short ErrorContIoActive = -33;
		public const short ErrorDblBufModeNotAllowed = -34;
		public const short ErrorConfigFailed = -35;
		public const short ErrorInvalidPortDirection = -36;
		public const short ErrorBeginThreadError = -37;
		public const short ErrorInvalidPortWidth = -38;
		public const short ErrorInvalidCtrSource = -39;
		public const short ErrorOpenFile = -40;
		public const short ErrorAllocateMemory = -41;
		public const short ErrorDaVoltageOutOfRange = -42;
		public const short ErrorDaExtRefNotAllowed = -43;
		public const short ErrorDIODataWidthError = -44;
		public const short ErrorTaskCodeError = -45;
		public const short ErrortriggercountError = -46;
		public const short ErrorInvalidTriggerMode = -47;
		public const short ErrorInvalidTriggerType = -48;
//Error code for driver API
		public const short ErrorConfigIoctl = -201;
		public const short ErrorAsyncSetIoctl = -202;
		public const short ErrorDBSetIoctl = -203;
		public const short ErrorDBHalfReadyIoctl = -204;
		public const short ErrorContOPIoctl = -205;
		public const short ErrorContStatusIoctl = -206;
		public const short ErrorPIOIoctl = -207;
		public const short ErrorDIntSetIoctl = -208;
		public const short ErrorWaitEvtIoctl = -209;
		public const short ErrorOpenEvtIoctl = -210;
		public const short ErrorCOSIntSetIoctl = -211;
		public const short ErrorMemMapIoctl = -212;
		public const short ErrorMemUMapSetIoctl = -213;
		public const short ErrorCTRIoctl = -214;
		public const short ErrorGetResIoctl = -215;

//Synchronous Mode
		public const short SYNCH_OP = 1;
		public const short ASYNCH_OP = 2;

//AD Range
		public const short AD_B_10_V = 1;
		public const short AD_B_5_V = 2;
		public const short AD_B_2_5_V = 3;
		public const short AD_B_1_25_V = 4;
		public const short AD_B_0_625_V = 5;
		public const short AD_B_0_3125_V = 6;
		public const short AD_B_0_5_V = 7;
		public const short AD_B_0_05_V = 8;
		public const short AD_B_0_005_V = 9;
		public const short AD_B_1_V = 10;
		public const short AD_B_0_1_V = 11;
		public const short AD_B_0_01_V = 12;
		public const short AD_B_0_001_V = 13;
		public const short AD_U_20_V = 14;
		public const short AD_U_10_V = 15;
		public const short AD_U_5_V = 16;
		public const short AD_U_2_5_V = 17;
		public const short AD_U_1_25_V = 18;
		public const short AD_U_1_V = 19;
		public const short AD_U_0_1_V = 20;
		public const short AD_U_0_01_V = 21;
		public const short AD_U_0_001_V = 22;

//Trigger Source
		public const short TRIG_SOFTWARE = 0;
		public const short TRIG_INT_PACER = 1;
		public const short TRIG_EXT_STROBE = 2;
		public const short TRIG_HANDSHAKE = 3;
			//PCI-7300A
		public const short TRIG_CLK_10MHZ = 4;
			//PCI-7300A
		public const short TRIG_CLK_20MHZ = 5;
			//PCI-7300A Rev. B
		public const short TRIG_DO_CLK_TIMER_ACK = 6;
			//PCI-7300A Rev. B
		public const short TRIG_DO_CLK_10M_ACK = 7;
			//PCI-7300A Rev. B
		public const short TRIG_DO_CLK_20M_ACK = 8;

//Virtual sampling rate for using external clock as the clock source
		public const short CLKSRC_EXT_SampRate = 10000;

//--------- Constants for PCI-6208A --------------
//Output Mode
		public const short P6208_CURRENT_0_20MA = 0;
		public const short P6208_CURRENT_5_25MA = 1;
		public const short P6208_CURRENT_4_20MA = 3;

//--------- Constants for PCI-6308A/PCI-6308V --------------
//Output Mode
		public const short P6308_CURRENT_0_20MA = 0;
		public const short P6308_CURRENT_5_25MA = 1;
		public const short P6308_CURRENT_4_20MA = 3;
//AO Setting
		public const short P6308V_AO_CH0_3 = 0;
		public const short P6308V_AO_CH4_7 = 1;
		public const short P6308V_AO_UNIPOLAR = 0;
		public const short P6308V_AO_BIPOLAR = 1;

//--------- Constants for PCI-7200 --------------
//InputMode
		public const short DI_WAITING = 0x2;
		public const short DI_NOWAITING = 0x0;

		public const short DI_TRIG_RISING = 0x4;
		public const short DI_TRIG_FALLING = 0x0;

		public const short IREQ_RISING = 0x8;
		public const short IREQ_FALLING = 0x0;

//Output Mode
		public const short OREQ_ENABLE = 0x10;
		public const short OREQ_DISABLE = 0x0;

		public const short OTRIG_HIGH = 0x20;
		public const short OTRIG_LOW = 0x0;

//--------- Constants for PCI-7248/7296 --------------
//DIO Port Direction
		public const short INPUT_PORT = 1;
		public const short OUTPUT_PORT = 2;

//Channel&Port
		public const short Channel_P1A = 0;
		public const short Channel_P1B = 1;
		public const short Channel_P1C = 2;
		public const short Channel_P1CL = 3;
		public const short Channel_P1CH = 4;
		public const short Channel_P1AE = 10;
		public const short Channel_P1BE = 11;
		public const short Channel_P1CE = 12;
		public const short Channel_P2A = 5;
		public const short Channel_P2B = 6;
		public const short Channel_P2C = 7;
		public const short Channel_P2CL = 8;
		public const short Channel_P2CH = 9;
		public const short Channel_P2AE = 15;
		public const short Channel_P2BE = 16;
		public const short Channel_P2CE = 17;
		public const short Channel_P3A = 10;
		public const short Channel_P3B = 11;
		public const short Channel_P3C = 12;
		public const short Channel_P3CL = 13;
		public const short Channel_P3CH = 14;
		public const short Channel_P4A = 15;
		public const short Channel_P4B = 16;
		public const short Channel_P4C = 17;
		public const short Channel_P4CL = 18;
		public const short Channel_P4CH = 19;
		public const short Channel_P5A = 20;
		public const short Channel_P5B = 21;
		public const short Channel_P5C = 22;
		public const short Channel_P5CL = 23;
		public const short Channel_P5CH = 24;
		public const short Channel_P6A = 25;
		public const short Channel_P6B = 26;
		public const short Channel_P6C = 27;
		public const short Channel_P6CL = 28;
		public const short Channel_P6CH = 29;
		public const short Channel_P1 = 30;
		public const short Channel_P2 = 31;
		public const short Channel_P3 = 32;
		public const short Channel_P4 = 33;
		public const short Channel_P1E = 34;
		public const short Channel_P2E = 35;
		public const short Channel_P3E = 36;
		public const short Channel_P4E = 37;

//--------- Constants for PCI-7300A --------------
//Wait Status
		public const short P7300_WAIT_NO = 0;
		public const short P7300_WAIT_TRG = 1;
		public const short P7300_WAIT_FIFO = 2;
		public const short P7300_WAIT_BOTH = 3;

//Terminator control
		public const short P7300_TERM_OFF = 0;
		public const short P7300_TERM_ON = 1;

//DI control signals polarity for PCI-7300A Rev. B
		public const short P7300_DIREQ_POS = 0x0;
		public const short P7300_DIREQ_NEG = 0x1;
		public const short P7300_DIACK_POS = 0x0;
		public const short P7300_DIACK_NEG = 0x2;
		public const short P7300_DITRIG_POS = 0x0;
		public const short P7300_DITRIG_NEG = 0x4;

//DO control signals polarity for PCI-7300A Rev. B
		public const short P7300_DOREQ_POS = 0x0;
		public const short P7300_DOREQ_NEG = 0x8;
		public const short P7300_DOACK_POS = 0x0;
		public const short P7300_DOACK_NEG = 0x10;
		public const short P7300_DOTRIG_POS = 0x0;
		public const short P7300_DOTRIG_NEG = 0x20;

//--------- Constants for PCI-7432/7433/7434 --------------
		public const short CHANNEL_DI_LOW = 0;
		public const short CHANNEL_DI_HIGH = 1;
		public const short CHANNEL_DO_LOW = 0;
		public const short CHANNEL_DO_HIGH = 1;
		public const short P7432R_DO_LED = 1;
		public const short P7433R_DO_LED = 0;
		public const short P7434R_DO_LED = 2;
		public const short P7432R_DI_SLOT = 1;
		public const short P7433R_DI_SLOT = 2;
		public const short P7434R_DI_SLOT = 0;

//----- Dual-Interrupt Source control for PCI-7248/49/96 & 7230 & 8554 & 7396-----
			//INT1 Disabled
		public const short INT1_DISABLE = -1;
			//INT1 COS : only available for PCI-7396, PCI-7256
		public const short INT1_COS = 0;
			//INT1 by Falling edge of P1C0
		public const short INT1_FP1C0 = 1;
			//INT1 by P1C0 Rising or P1C3 Falling
		public const short INT1_RP1C0_FP1C3 = 2;
			//INT1 by Event Counter down to zero
		public const short INT1_EVENT_COUNTER = 3;
			//INT1 by external signal : only available for PCI7432/PCI7433/PCI7230
		public const short INT1_EXT_SIGNAL = 1;
			//INT1 COUT12 : only available for PCI8554
		public const short INT1_COUT12 = 1;
			//           INT1 CH0 : only available for PCI7256
		public const short INT1_CH0 = 1;
			//INT2 Disabled
		public const short INT2_DISABLE = -1;
			//INT2 COS : only available for PCI-7396
		public const short INT2_COS = 0;
			//INT2 by Falling edge of P2C0
		public const short INT2_FP2C0 = 1;
			//INT2 by P2C0 Rising or P2C3 Falling
		public const short INT2_RP2C0_FP2C3 = 2;
			//INT2 by Timer Counter down to zero
		public const short INT2_TIMER_COUNTER = 3;
			//INT2 by external signal : only available for PCI7432/PCI7433/PCI7230
		public const short INT2_EXT_SIGNAL = 1;
			//INT2 CH1 : only available for PCI7256
		public const short INT2_CH1 = 2;

//-------- Constants for PCI-8554 --------------------
//Clock Source of Cunter N
		public const short ECKN = 0;
		public const short COUTN_1 = 1;
		public const short CK1 = 2;
		public const short COUT10 = 3;

//Clock Source of CK1
		public const short CK1_C8M = 0;
		public const short CK1_COUT11 = 1;

//Debounce Clock
		public const short DBCLK_COUT11 = 0;
		public const short DBCLK_2MHZ = 1;

//--------- Constants for PCI-9111 --------------
//Dual Interrupt Mode
			//Ending of AD conversion
		public const short P9111_INT1_EOC = 0;
			//FIFO Half Full
		public const short P9111_INT1_FIFO_HF = 1;
			//Every Timer tick
		public const short P9111_INT2_PACER = 0;
			//ExtTrig High->Low
		public const short P9111_INT2_EXT_TRG = 1;

//Channel Count
		public const short P9111_CHANNEL_DO = 0;
		public const short P9111_CHANNEL_EDO = 1;
		public const short P9111_CHANNEL_DI = 0;
		public const short P9111_CHANNEL_EDI = 1;

//Trigger Mode
			//Software Trigger Mode
		public const short P9111_TRGMOD_SOFT = 0;
			//Pre-Trigger Mode
		public const short P9111_TRGMOD_PRE = 1;
			//Post Trigger Mode
		public const short P9111_TRGMOD_POST = 2;

//EDO function
			//EDO port set as Input port
		public const short P9111_EDO_INPUT = 1;
			//EDO port set as Output port
		public const short P9111_EDO_OUT_EDO = 2;
			//EDO port set as channel number ouput port
		public const short P9111_EDO_OUT_CHN = 3;

//AO Setting
		public const short P9111_AO_UNIPOLAR = 0;
		public const short P9111_AO_BIPOLAR = 1;

//--------- Constants for PCI-9118 --------------
		public const short P9118_AI_BiPolar = 0x0;
		public const short P9118_AI_UniPolar = 0x1;

		public const short P9118_AI_SingEnded = 0x0;
		public const short P9118_AI_Differential = 0x2;

		public const short P9118_AI_ExtG = 0x4;

		public const short P9118_AI_ExtTrig = 0x8;

		public const short P9118_AI_DtrgNegative = 0x0;
		public const short P9118_AI_DtrgPositive = 0x10;

		public const short P9118_AI_EtrgNegative = 0x0;
		public const short P9118_AI_EtrgPositive = 0x20;

		public const short P9118_AI_BurstModeEn = 0x40;
		public const short P9118_AI_SampleHold = 0x80;
		public const short P9118_AI_PostTrgEn = 0x100;
		public const short P9118_AI_AboutTrgEn = 0x200;

//--------- Constants for PCI-9812/9810 --------------
//Channel Count
		public const short P9116_AI_LocalGND = 0x0;
		public const short P9116_AI_UserCMMD = 0x1;
		public const short P9116_AI_SingEnded = 0x0;
		public const short P9116_AI_Differential = 0x2;
		public const short P9116_AI_BiPolar = 0x0;
		public const short P9116_AI_UniPolar = 0x4;

			//Software Trigger Mode
		public const short P9116_TRGMOD_SOFT = 0x0;
			//Post Trigger Mode
		public const short P9116_TRGMOD_POST = 0x10;
			//Delay Trigger Mode
		public const short P9116_TRGMOD_DELAY = 0x20;
			//Pre-Trigger Mode
		public const short P9116_TRGMOD_PRE = 0x30;
			//Middle Trigger Mode
		public const short P9116_TRGMOD_MIDL = 0x40;
		public const short P9116_AI_TrgPositive = 0x0;
		public const short P9116_AI_TrgNegative = 0x80;
		public const short P9116_AI_IntTimeBase = 0x0;
		public const short P9116_AI_ExtTimeBase = 0x100;
		public const short P9116_AI_DlyInSamples = 0x200;
		public const short P9116_AI_DlyInTimebase = 0x0;
		public const short P9116_AI_ReTrigEn = 0x400;
		public const short P9116_AI_MCounterEn = 0x800;
		public const short P9116_AI_SoftPolling = 0x0;
		public const short P9116_AI_INT = 0x1000;
		public const short P9116_AI_DMA = 0x2000;

//--------- Constants for PCI-9812/9810 --------------
//Channel Count
		public const short P9812_CHANNEL_CNT1 = 1;
		public const short P9812_CHANNEL_CNT2 = 2;
		public const short P9812_CHANNEL_CNT4 = 4;

//Trigger Mode
			//Software Trigger Mode
		public const short P9812_TRGMOD_SOFT = 0;
			//Post Trigger Mode
		public const short P9812_TRGMOD_POST = 1;
			//Pre-Trigger Mode
		public const short P9812_TRGMOD_PRE = 2;
			//Delay Trigger Mode
		public const short P9812_TRGMOD_DELAY = 3;
			//Middle Trigger Mode
		public const short P9812_TRGMOD_MIDL = 4;

//Trigger Source
			//trigger source --CH0
		public const short P9812_TRGSRC_CH0 = 0;
			//trigger source --CH1
		public const short P9812_TRGSRC_CH1 = 8;
			//trigger source --CH2
		public const short P9812_TRGSRC_CH2 = 0x10;
			//trigger source --CH3
		public const short P9812_TRGSRC_CH3 = 0x18;
			//External Digital Trigger
		public const short P9812_TRGSRC_EXT_DIG = 0x20;

//Trigger Polarity
			//Positive slope trigger
		public const short P9812_TRGSLP_POS = 0;
			//Negative slope trigger
		public const short P9812_TRGSLP_NEG = 0x40;

//Frequency Selection
			//Freq. of A/D clock > PCI clock freq.
		public const short P9812_AD2_GT_PCI = 0x80;
			//Freq. of A/D clock < PCI clock freq.
		public const short P9812_AD2_LT_PCI = 0x0;

//Clock Source
			//Internal clock
		public const short P9812_CLKSRC_INT = 0x0;
			//External SIN wave clock
		public const short P9812_CLKSRC_EXT_SIN = 0x100;
			//External Square wave clock
		public const short P9812_CLKSRC_EXT_DIG = 0x200;

//DAQ Event type for the event message
		public const short AIEnd = 0;
		public const short DIEnd = 0;
		public const short DOEnd = 0;
		public const short DBEvent = 1;

//--------- Constants for Timer/Counter --------------
//Counter Mode (8254)
			//Toggle output from low to high on terminal count
		public const short TOGGLE_OUTPUT = 0;
			//Programmable one-shot
		public const short PROG_ONE_SHOT = 1;
			//Rate generator
		public const short RATE_GENERATOR = 2;
			//Square wave rate generator
		public const short SQ_WAVE_RATE_GENERATOR = 3;
			//Software-triggered strobe
		public const short SOFT_TRIG = 4;
			//Hardware-triggered strobe
		public const short HARD_TRIG = 5;

//------- General Purpose Timer/Counter -----------------
//Counter Mode
			//general counter
		public const short General_Counter = 0x0;
			//pulse generation
		public const short Pulse_Generation = 0x1;
//GPTC clock source
		public const short GPTC_CLKSRC_EXT = 0x8;
		public const short GPTC_CLKSRC_INT = 0x0;
		public const short GPTC_GATESRC_EXT = 0x10;
		public const short GPTC_GATESRC_INT = 0x0;
		public const short GPTC_UPDOWN_SELECT_EXT = 0x20;
		public const short GPTC_UPDOWN_SELECT_SOFT = 0x0;
		public const short GPTC_UP_CTR = 0x40;
		public const short GPTC_DOWN_CTR = 0x0;
		public const short GPTC_ENABLE = 0x80;
		public const short GPTC_DISABLE = 0x0;

//16-bit binary or 4-decade BCD counter
		public const short BIN = 0;
		public const short BCD = 1;
		[DllImport("kernel32", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern int WaitForSingleObject(int hHandle, int dwMilliseconds);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short Register_Card(short cardType, short card_num);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short Release_Card(short CardNumber);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short GetActualRate(short CardNumber, double SampleRate, ref double ActualRate);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short GetCardType(short CardNumber, ref short cardType);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short GetBaseAddr(short CardNumber, ref int BaseAddr, ref int BaseAddr2);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short GetLCRAddr(short CardNumber, ref int LcrAddr);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_9111_Config(short CardNumber, short TrigSource, short TrgMode, short wTraceCnt);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_9112_Config(short CardNumber, short TrigSource);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_9113_Config(short CardNumber, short TrigSource);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_9114_Config(short CardNumber, short TrigSource);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_9114_PreTrigConfig(short CardNumber, short PreTrgEn, short TraceCnt);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_9116_Config(short CardNumber, short ConfigCtrl, short TrigCtrl, short PostCnt, short MCnt, short ReTrgCnt);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_9118_Config(short CardNumber, short wModeCtrl, short wFunCtrl, short wBurstCnt, short wPostCnt);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_9812_Config(short CardNumber, short wTrgMode, short wTrgSrc, short wTrgPol, short wClkSel, short wTrgLevel, short wPostCnt);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_9116_CounterInterval(short CardNumber, int ScanIntrv, int SampIntrv);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_9812_SetDiv(short CardNumber, int pacerVal);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_AsyncCheck(short CardNumber, ref byte Stopped, ref int AccessCnt);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_AsyncClear(short CardNumber, ref int AccessCnt);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_AsyncDblBufferHalfReady(short CardNumber, ref byte HalfReady, ref byte StopFlag);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_AsyncDblBufferMode(short CardNumber, byte Enable);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_AsyncDblBufferTransfer(short CardNumber, ref short Buffer);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_ContReadChannel(short CardNumber, short Channel, short AdRange, ref short Buffer, int ReadCount, double SampleRate, short SyncMode);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_ContScanChannels(short wCardNumber, short wChannel, short wAdRange, ref short pwBuffer, int dwReadCount, double SampleRate, short SyncMode);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_ContReadMultiChannels(short CardNumber, short NumChans, ref short chans, ref short AdRanges, ref short Buffer, int ReadCount, double SampleRate, short SyncMode);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_ContReadChannelToFile(short CardNumber, short Channel, short AdRange, string FileName, int ReadCount, double SampleRate, short SyncMode);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_ContScanChannelsToFile(short wCardNumber, short wChannel, short wAdRange, string FileName, int dwReadCount, double SampleRate, short SyncMode);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_ContReadMultiChannelsToFile(short CardNumber, short NumChans, ref short chans, ref short AdRanges, string FileName, int ReadCount, double SampleRate, short SyncMode);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_ContStatus(short CardNumber, ref short Status);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_InitialMemoryAllocated(short CardNumber, ref int MemSize);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_ReadChannel(short CardNumber, short Channel, short AdRange, ref short Value);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_VReadChannel(short CardNumber, short Channel, short AdRange, ref double Voltage);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_VoltScale(short CardNumber, short AdRange, short reading, ref double Voltage);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_ContVScale(short CardNumber, short AdRange, ref short readingArray, ref double voltageArray, int Count);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_AsyncDblBufferOverrun(short CardNumber, short op, ref short overrunFlag);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_EventCallBack(short CardNumber, short Mode, short EventType, int callbackAddr);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AO_6208A_Config(short CardNumber, short V2AMode);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AO_6308A_Config(short CardNumber, short V2AMode);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AO_6308V_Config(short CardNumber, short Channel, short OutputPolarity, double refVoltage);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AO_9111_Config(short CardNumber, short OutputPolarity);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AO_9112_Config(short CardNumber, short Channel, double refVoltage);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AO_WriteChannel(short CardNumber, short Channel, short Value);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AO_VWriteChannel(short CardNumber, short Channel, double Voltage);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AO_VoltScale(short CardNumber, short Channel, double Voltage, ref short binValue);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AO_SimuWriteChannel(short CardNumber, short wGroup, ref short valueArray);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AO_SimuVWriteChannel(short CardNumber, short wGroup, ref double voltageArray);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DI_7200_Config(short CardNumber, short TrigSource, short wExtTrigEn, short wTrigPol, short wI_REQ_Pol);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DI_7300A_Config(short CardNumber, short PortWidth, short TrigSource, short WaitStatus, short Terminaor, short I_REQ_Pol, byte clear_fifo, byte disable_di);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DI_7300B_Config(short CardNumber, short PortWidth, short TrigSource, short WaitStatus, short Terminator, short I_Cntrl_Pol, byte clear_fifo, byte disable_di);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DI_AsyncCheck(short CardNumber, ref byte Stopped, ref int AccessCnt);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DI_AsyncClear(short CardNumber, ref int AccessCnt);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DI_AsyncDblBufferHalfReady(short CardNumber, ref byte HalfReady);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DI_AsyncDblBufferMode(short CardNumber, byte Enable);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DI_ContMultiBufferStart(short CardNumber, short Port, double SampleRate);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DI_AsyncMultiBufferNextReady(short CardNumber, ref byte NextReady, ref short BufferId);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DI_ContReadPortToFile(short CardNumber, short Port, string FileName, int ReadCount, double SampleRate, short SyncMode);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DI_ContStatus(short CardNumber, ref short Status);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DI_InitialMemoryAllocated(short CardNumber, ref int MemSize);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DI_ReadPort(short CardNumber, short Port, ref int Value);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DI_ReadLine(short CardNumber, short Port, short Line, ref short Value);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DI_AsyncDblBufferOverrun(short CardNumber, short op, ref short overrunFlag);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DI_EventCallBack(short CardNumber, short Mode, short EventType, int callbackAddr);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DO_7200_Config(short CardNumber, short TrigSource, short wOutReqEn, short wOutTrigSig);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DO_7300A_Config(short CardNumber, short PortWidth, short TrigSource, short WaitStatus, short Terminaor, short O_REQ_Pol);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DO_7300B_Config(short CardNumber, short PortWidth, short TrigSource, short WaitStatus, short Terminator, short O_Cntrl_Pol, int FifoThreshold);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DO_AsyncCheck(short CardNumber, ref byte Stopped, ref int AccessCnt);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DO_AsyncClear(short CardNumber, ref int AccessCnt);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DO_ContStatus(short CardNumber, ref short Status);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DO_InitialMemoryAllocated(short CardNumber, ref int MemSize);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DO_PGStop(short CardNumber);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DO_WritePort(short CardNumber, short Port, int Value);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DO_WriteLine(short CardNumber, short Port, short Line, short Value);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DO_ReadLine(short CardNumber, short Port, short Line, ref short Value);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DO_ReadPort(short CardNumber, short Port, ref int Value);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short EDO_9111_Config(short CardNumber, short wEDO_Fun);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DO_WriteExtTrigLine(short CardNumber, short Value);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DO_ContMultiBufferStart(short CardNumber, short Port, double SampleRate);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DO_AsyncMultiBufferNextReady(short CardNumber, ref byte NextReady, ref short BufferId);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DO_EventCallBack(short CardNumber, short Mode, short EventType, int callbackAddr);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DIO_PortConfig(short CardNumber, short Port, short Direction);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DIO_SetDualInterrupt(short wCardNumber, short wInt1Mode, short wInt2Mode, ref int hEvent);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DIO_SetCOSInterrupt(short wCardNumber, short Port, short ctlA, short ctlB, short ctlC);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DIO_GetCOSLatchData(short CardNumber, ref int CosLData);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DIO_INT1_EventMessage(short CardNumber, short Int1Mode, int windowHandle, int message, int callbackAddr);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DIO_INT2_EventMessage(short CardNumber, short Int2Mode, int windowHandle, int message, int callbackAddr);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DIO_7300SetInterrupt(short wCardNumber, short AuxDIEn, short T2En, ref int hEvent);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DIO_AUXDI_EventMessage(short CardNumber, short AuxDIEn, int windowHandle, int message, int callbackAddr);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DIO_T2_EventMessage(short CardNumber, short T2En, int windowHandle, int message, int callbackAddr);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short CTR_Setup(short CardNumber, short Ctr, short Mode, int Count, short BinBcd);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short CTR_Clear(short CardNumber, short Ctr, short State);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short CTR_Read(short CardNumber, short Ctr, ref int Value);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short CTR_Update(short CardNumber, short Ctr, int Count);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short CTR_8554_ClkSrc_Config(short CardNumber, short Ctr, short ClockSource);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short CTR_8554_CK1_Config(short CardNumber, short ClockSource);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short CTR_8554_Debounce_Config(short CardNumber, short DebounceClock);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short GCTR_Setup(short CardNumber, short wGCtr, short wGCtrCtrl, int dwCount);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short GCTR_Clear(short CardNumber, short wGCtr);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short GCTR_Read(short CardNumber, short wGCtr, ref int pValue);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AI_GetEvent(short CardNumber, ref int hEvent);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short AO_GetEvent(short CardNumber, ref int hEvent);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DI_GetEvent(short CardNumber, ref int hEvent);
		[DllImport("Pci-Dask.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
		public static extern short DO_GetEvent(short CardNumber, ref int hEvent);


//-------------------------------------------------------------------
//  PCIS-DASK Function prototype
//-----------------------------------------------------------------*/

//AI Functions

//AO Functions

//DI Functions
		//'UPGRADE_ISSUE: Declaring a parameter 'As Any' is not supported. Click for more: 'ms-help://MS.VSExpressCC.v80/dv_commoner/local/redirect.htm?keyword="FAE78A8D-8978-4FD4-8208-5B7324A8F795"'
		//Declare Function DI_AsyncDblBufferTransfer Lib "Pci-Dask.dll" (ByVal CardNumber As Short, ByRef Buffer As Any) As Short
//UPGRADE_ISSUE: Declaring a parameter 'As Any' is not supported. Click for more: 'ms-help://MS.VSExpressCC.v80/dv_commoner/local/redirect.htm?keyword="FAE78A8D-8978-4FD4-8208-5B7324A8F795"'
		//Declare Function DI_ContMultiBufferSetup Lib "Pci-Dask.dll" (ByVal CardNumber As Short, ByRef Buffer As Any, ByVal ReadCount As Integer, ByRef BufferId As Short) As Short
//UPGRADE_ISSUE: Declaring a parameter 'As Any' is not supported. Click for more: 'ms-help://MS.VSExpressCC.v80/dv_commoner/local/redirect.htm?keyword="FAE78A8D-8978-4FD4-8208-5B7324A8F795"'
		//Declare Function DI_ContReadPort Lib "Pci-Dask.dll" (ByVal CardNumber As Short, ByVal Port As Short, ByRef Buffer As Any, ByVal ReadCount As Integer, ByVal SampleRate As Double, ByVal SyncMode As Short) As Short

//DO Functions
//UPGRADE_ISSUE: Declaring a parameter 'As Any' is not supported. Click for more: 'ms-help://MS.VSExpressCC.v80/dv_commoner/local/redirect.htm?keyword="FAE78A8D-8978-4FD4-8208-5B7324A8F795"'
		//Declare Function DO_ContWritePort Lib "Pci-Dask.dll" (ByVal CardNumber As Short, ByVal Port As Short, ByRef Buffer As Any, ByVal WriteCount As Integer, ByVal Iterations As Short, ByVal SampleRate As Double, ByVal SyncMode As Short) As Short
//UPGRADE_ISSUE: Declaring a parameter 'As Any' is not supported. Click for more: 'ms-help://MS.VSExpressCC.v80/dv_commoner/local/redirect.htm?keyword="FAE78A8D-8978-4FD4-8208-5B7324A8F795"'
		//Declare Function DO_PGStart Lib "Pci-Dask.dll" (ByVal CardNumber As Short, ByRef Buffer As Any, ByVal WriteCount As Integer, ByVal SampleRate As Double) As Short
//UPGRADE_ISSUE: Declaring a parameter 'As Any' is not supported. Click for more: 'ms-help://MS.VSExpressCC.v80/dv_commoner/local/redirect.htm?keyword="FAE78A8D-8978-4FD4-8208-5B7324A8F795"'
		//Declare Function DO_ContMultiBufferSetup Lib "Pci-Dask.dll" (ByVal CardNumber As Short, ByRef Buffer As Any, ByVal WriteCount As Integer, ByRef BufferId As Short) As Short

//DIO Functions

//Counter Functions

	}
}
